﻿
namespace BEGDC.PreContract.DAL
{
    using System;
    using System.Collections.Generic;
    using Castle.ActiveRecord;
    using NHibernate.Expression;


    [ActiveRecord]
    public partial class BD : ActiveRecordBase<BD>
    {
		#region Const Definition
		
		public const string CONST_BDID									= "BDID";
		public const string CONST_BDCode								= "BDCode";
		public const string CONST_SortNumber							= "SortNumber";
		public const string CONST_CreateDate							= "CreateDate";
		public const string CONST_Active								= "Active";
		public const string CONST_Division								= "Division";
		public const string CONST_BGID									= "BGID";
		public const string CONST_UpdateDate							= "UpdateDate";
		public const string CONST_BDDescription							= "BDDescription";

		#endregion
		
        #region Member Variables
        // Primary Key
        private System.Int32 _bDID;
        
        // Non Key
        private System.String _bDCode;
        private Nullables.NullableInt32 _sortNumber;
        private Nullables.NullableDateTime _createDate;
        private System.Boolean _active;
        private System.String _division;
        private Nullables.NullableDateTime _updateDate;
        private System.String _bDDescription;

        // Parents
        private BG _bGID;
        
        
		

        #endregion

        public BD() {
               
        }
        public BD(
            System.String bDCode
            ,Nullables.NullableInt32 sortNumber
            ,Nullables.NullableDateTime createDate
            ,System.Boolean active
            ,System.String division
            ,Nullables.NullableDateTime updateDate
            ,System.String bDDescription) : this() {
                
            this._bDCode = bDCode; 
            this._sortNumber = sortNumber; 
            this._createDate = createDate; 
            this._active = active; 
            this._division = division; 
            this._updateDate = updateDate; 
            this._bDDescription = bDDescription; 
        }
        
        #region Properties
        // Primary Key        
		
		#if (SQLServer)
        [PrimaryKey]
		#else
		[PrimaryKey(PrimaryKeyType.Native, SequenceName = "SEQ_BD_BDID")]
		#endif
        public System.Int32 BDID {
            get { return this._bDID; }
            set {  this._bDID = value; }
        }
        
        // Non Key
        [Property]
        public System.String BDCode {
            get { return this._bDCode; }
			set { if (value == null) return; if (value.Length > 15) this._bDCode = value.Substring(0,15); else this._bDCode = value; }	
        }
        
        [Property]
        public Nullables.NullableInt32 SortNumber {
            get { return this._sortNumber; }
			set { this._sortNumber = value; }
        }
        
        [Property]
        public Nullables.NullableDateTime CreateDate {
            get { return this._createDate; }
			set { this._createDate = value; }
        }
        
        [Property]
        public System.Boolean Active {
            get { return this._active; }
			set { this._active = value; }
        }
        
        [Property]
        public System.String Division {
            get { return this._division; }
			set { if (value == null) return; if (value.Length > 50) this._division = value.Substring(0,50); else this._division = value; }	
        }
        
        [Property]
        public Nullables.NullableDateTime UpdateDate {
            get { return this._updateDate; }
			set { this._updateDate = value; }
        }
        
        [Property]
        public System.String BDDescription {
            get { return this._bDDescription; }
			set { if (value == null) return; if (value.Length > 50) this._bDDescription = value.Substring(0,50); else this._bDDescription = value; }	
        }
        
        
        // Parent Relationships
        [BelongsTo("BGID")]
        public BG BGID {
            get { return this._bGID; }
            set { this._bGID = value; }
        }
        
        // Child Relationships
        
		
        #endregion
		
		// Clone
		public BD Clone()
		{
			BD newBD = new BD();
			
            newBD.BDCode = this._bDCode; 
            newBD.SortNumber = this._sortNumber; 
            newBD.CreateDate = this._createDate; 
            newBD.Active = this._active; 
            newBD.Division = this._division; 
            newBD.UpdateDate = this._updateDate; 
            newBD.BDDescription = this._bDDescription; 
            newBD.BGID = this._bGID ; 
			return newBD;
		}
    }
}



